<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="${webPath }/lib/css/global.css" media="all" />
<link rel="stylesheet" href="${webPath }/lib/layuicms/layui/css/layui.css" media="all" />
 <%@include file="/WEB-INF/common/script.jsp"%><!--静态包含-->
 <script type="text/javascript">
 var classifyId = '${modle.id }'.trim();
 </script>
<title>Insert title here</title>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>专项练习-${modle.name }</legend>
 </fieldset>

  <div align="center" id="laypageDiv"></div>
  <script type="text/javascript" src="${webPath }/lib/layuicms/layui/layui.js"></script>
  <script type="text/javascript">
  layui.use(['layer', 'laypage','jquery'], function() {
	  var $ = layui.jquery
	  ,laypage = layui.laypage;
	  
	  function laypageAjax(page,limit,classifyId){
		   $.ajax({
				url : webPath + '/subjectController/ajaxList',
				data:{page:page,limit:limit,classifyId:classifyId},
				type : 'post', 
				dataType : 'json',
				success : function(json) {
					if(json.code === 0){
						var html = '';
						layui.each(json.data,function(index,item){
							html+=' <div  class="layui-col-xs2 ">'
							+'<div class="grid-demo"><a data-url="'+webPath+'answerController/list?id='+item.id+'"><cite>'+item.name+'</cite></a></div>'
							+'</div>';
						});
						$('.layui-row').html(html);
						   laypage.render({
							     elem: 'laypageDiv'
							     ,count: json.count
							     ,curr:page
							     ,limit:limit
							     ,layout: ['count', 'prev', 'page', 'next', 'skip']
							     ,jump: function(obj, first){
							    	 if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
							    		 laypageAjax(obj.curr,obj.limit);
						                };
							     }
							   });
					}
				},
				error : function() {
					layer.msg('系统出错,请联系管理员');
				}
			});
	  };
	  
	  classifyId != ''? laypageAjax(1,24,classifyId):layer.msg('加载失败，请刷新！')  ;

  });
  </script>
</body>
</html>